package com.sc.demo.configration;

import org.apache.ibatis.plugin.Interceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.sc.demo.plugins.MasterSlaveAutoRouterPlugin;
import com.sc.demo.plugins.TableRouterPlugin;

/**
 * @author huan
 *
 */
@Configuration
public class MybatisConfiguration {

    /**    
     * interceptors(水平分表路由插件)    
     * @param   name    
     * @param  @return    设定文件    
     * @return String    DOM对象    
     * @Exception 异常对象    
     * @since  CodingExample　Ver(编码范例查看) 1.1    
    */
    @Bean
    public Interceptor initTableRouterPlugin() {
        return  new TableRouterPlugin();
    }

    /**    
     * interceptors(读写分离插件)    
     * @param   name    
     * @param  @return    设定文件    
     * @return String    DOM对象    
     * @Exception 异常对象    
     * @since  CodingExample　Ver(编码范例查看) 1.1    
    */
    @Bean
    public Interceptor MasterSlaveAutoRouterPlugin() {
        return new MasterSlaveAutoRouterPlugin();
    }

}
